package com.bdy.lm.taximanager.rfid;

/**
 * Created by Administrator on 2016/9/13 0013.
 */
import java.util.Locale;

public class TConvert {

    // 获取16进制形式串
    public static String hexString(byte[] dataArray, int dataLength) {
        String hexChar;
        StringBuilder hexString = new StringBuilder();
        for (int i = 0; i < dataLength; i++) {
            hexChar = Integer.toHexString(dataArray[i] & 0xFF);
            if (hexChar.length() == 1) {
                hexString.append('0');
            }
            hexString.append(hexChar);
            //hexString.append(' ');
        }
        if (hexString.length() > 0) {
            hexString.deleteCharAt(hexString.length() - 1);
        }
        return hexString.toString().toUpperCase(Locale.ENGLISH);
    }

}